using System.Text.Json.Nodes;

namespace FastDevTemplate.DataAccess;

public static class ConfigReader
{
    public static readonly string ConnectionString;
    
    public const string JsonPath = "efconfig.json";
    
    static ConfigReader()
    {
        var jsonString = File.ReadAllText(JsonPath);
        var docment = JsonNode.Parse(jsonString)!;
        ConnectionString = docment["ConnectionStrings"]?["ConnectionString"]?.GetValue<string>() ?? throw new Exception("Connection String is Empty.");
    }
}